<%--
  Created by IntelliJ IDEA.
  User: LJS
  Date: 2018/11/15
  Time: 10:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName()
            + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>公告明示</title>
    <jsp:include page="resource.jsp"/>
    <script type="text/javascript">

        //updateNotice
        function updateNotice(){
            var titleId = $("#companyNoticeTitleId").val();
            var title = $("#companyNoticeTitle").val();

            var contentId = $("#companyNoticeContentId").val();
            var content = $("#companyNoticeContent").val();

            $.ajax({
                url:"${pageContext.request.contextPath}/notice/company/update.do",
                type:"post",
                async:false,
                data:{
                    companyNoticeTitleId: titleId,
                    companyNoticeTitle: title,
                    companyNoticeContentId: contentId,
                    companyNoticeContent: content
                },
                dataType: 'json',
                success:function(data){

                    if(data.res.trim() === "1" ) {
                        window.location.reload();
                    }else{
                        //...
                    }
                }
            })
        }

    </script>
</head>
<body>
<jsp:include page="common.jsp"/>

<!-- Start #content -->
<div id="content">
    <!-- Start .content-wrapper -->
    <div class="content-wrapper">
        <!-- Start .row -->
        <div class="row">
            <!-- Start .page-header -->
            <div class="col-lg-12 heading">
                <h1 class="page-header"><i class="im-bullhorn"></i> 公告明示</h1>
            </div>
            <!-- End .page-header -->
        </div>
        <!-- End .row -->
        <!-- Start .outlet -->
        <div class="outlet">
            <!-- Page start here ( usual with .row ) -->
            <div class="row">
                <!-- col-lg-12 start here -->
                <div class="col-lg-12">
                    <div class="page-header">
                        <h5>
                            <i class="en-flag color-red mt0"></i>公司公告
                            <a href="#" class="pull-right" data-toggle="modal" data-target="#myModal"><i class="ec-pencil mt0"></i> 修改</a>
                        </h5>
                    </div>
                    <!-- Start .panel -->
                    <div class="panel panel-default toggle panelRefresh panelClose showControls">
                        <div class="panel-heading">
                            <h4 class="panel-title">${companyNoticeTitleAttr.attrContent}</h4>
                        </div>
                        <div class="panel-body">
                            <div class="scroll">
                                ${companyNoticeContentAttr.attrContent}
                            </div>
                        </div>
                    </div>
                    <!-- End .panel -->
                </div>
                <!-- col-lg-12 end here -->
            </div>
            <!-- End .row -->
            <%--<div class="row">
                <!-- col-lg-12 start here -->
                <div class="col-lg-12">
                    <div class="page-header">
                        <h5>
                            <i class="en-flag color-red mt0"></i>部门公告
                            <a href="#" class="pull-right" data-toggle="modal" data-target="#myModal"><i class="ec-pencil mt0"></i> 修改</a>
                        </h5>
                    </div>
                    <!-- Start .panel -->
                    <div class="panel panel-default toggle panelRefresh panelClose showControls">
                        <div class="panel-heading">
                            <h4 class="panel-title">人事部新招萌新1人！！</h4>
                        </div>
                        <div class="panel-body">
                            <div class="scroll">
                                Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nam, quo facilis magni consequuntur iusto reprehenderit impedit inventore expedita dolorum dolore. Consectetur, debitis, accusamus quae omnis aliquid iure beatae nihil esse consequuntur tenetur
                                error blanditiis vero nam aliquam sapiente molestiae iste animi. Voluptatem, molestiae, labore adipisci delectus doloremque sequi laborum cupiditate aut ullam id dolore dolor esse architecto magni a nam incidunt
                                vero rerum voluptate natus deserunt aperiam provident non nostrum saepe expedita perferendis beatae. Ut, placeat, nostrum, dolor veritatis eaque cum assumenda voluptatibus distinctio eum laborum accusantium nobis
                                nam repudiandae animi perspiciatis delectus recusandae labore tempore provident quia ullam aspernatur voluptates excepturi ad quidem! Blanditiis, minus repellendus magnam reprehenderit laboriosam possimus enim dolorum
                                eos debitis iste. Ipsum, explicabo, earum corporis nisi quaerat omnis cupiditate magni error totam accusantium natus numquam quam amet cumque rem voluptatibus atque sapiente beatae doloremque facere? Qui, voluptate
                                suscipit ipsum aperiam enim quae a cumque quas excepturi illum hic ex. Neque, quae officia veritatis iure consequuntur ipsa magnam repudiandae dignissimos architecto rerum quis ad adipisci. Officia, rerum, omnis
                                ab beatae praesentium placeat temporibus quaerat aut porro ratione? Dolores, molestias, libero, officiis deleniti impedit explicabo quis consectetur modi reprehenderit ullam fugit aliquid. Iusto incidunt minima
                                optio neque.
                            </div>
                        </div>
                    </div>
                    <!-- End .panel -->
                </div>
                <!-- col-lg-12 end here -->
            </div>--%>
            <!-- End .row -->
            <div class="row">
                <!-- col-lg-12 start here -->
                <div class="col-lg-12">
                    <div class="page-header">
                        <h5>
                            <i class="en-flag color-red mt0"></i>值班表
                            <a href="<%=basePath%>notice/all/list.do" class="pull-right"><i class="ec-pencil mt0"></i> 更多</a>
                        </h5>
                    </div>
                    <jsp:useBean id="rotaTable" class="net.office.utils.CalendarBean" scope="session" />
                    <jsp:setProperty name="rotaTable" property="workTableList" value="${workTableList}"/>
                    <jsp:getProperty name="rotaTable" property="calendar" />
                </div>
                <!-- col-lg-12 end here -->
            </div>
            <!-- End .row -->
            <!-- Page End here -->
        </div>
        <!-- End .outlet -->
    </div>
    <!-- End .content-wrapper -->
    <div class="clearfix"></div>
</div>
<!-- End #content -->

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h5 class="modal-title" id="myModalLabel">编辑公告</h5>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form">
                    <div class="form-group">
                        <label for="companyNoticeTitle" class="col-sm-2 control-label">标题：</label>
                        <div class="col-sm-10">
                            <input type="hidden" id="companyNoticeTitleId" name="companyNoticeTitleId" value="${companyNoticeTitleAttr.attrId}"/>
                            <input type="text" class="form-control limitInput" maxlength="20"
                                   id="companyNoticeTitle" name="companyNoticeTitle" value="${companyNoticeTitleAttr.attrContent}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="companyNoticeContent" class="col-sm-2 control-label">内容：</label>
                        <div class="col-sm-10">
                            <input type="hidden" id="companyNoticeContentId" name="companyNoticeContentId" value="${companyNoticeContentAttr.attrId}"/>
                            <textarea class="form-control limitTextarea" maxlength="350" rows="10"
                                      id="companyNoticeContent" name="companyNoticeContent">${companyNoticeContentAttr.attrContent}</textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="updateNotice()">保存修改</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</body>
</html>
